<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>{% block title %}运动健康管理系统{% endblock %}</title>
    <link
      rel="stylesheet"
      href="{{ url_for('static', filename='styles/main.css') }}" />
    <link
      rel="stylesheet"
      href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" />
    <link
      rel="stylesheet"
      href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" />
    {% block extra_css %}{% endblock %}
  </head>
  <body>
    <header>{% include 'includes/navbar.html' %}</header>

    <main class="container my-4">
      <div class="container mt-3">
        {% with messages = get_flashed_messages() %} {% if messages %} {% for
        message in messages %}
        <div class="alert alert-info alert-dismissible fade show" role="alert">
          {{ message }}
          <button
            type="button"
            class="btn-close"
            data-bs-dismiss="alert"
            aria-label="Close"></button>
        </div>
        {% endfor %} {% endif %} {% endwith %}
      </div>

      {% block content %}{% endblock %}
    </main>

    <footer class="bg-dark text-white py-4 mt-5">
      <div class="container">
        <div class="row">
          <div class="col-md-6">
            <h5>KeepRun</h5>
            <p>致力于提供专业的健康管理服务</p>
          </div>
        </div>
      </div>
    </footer>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    {% block extra_js %}{% endblock %}
  </body>
</html>

<div class="collapse navbar-collapse" id="navbarNav">
  <ul class="navbar-nav me-auto">
    {% if current_user.is_authenticated and current_user.is_admin %}
    <!-- 管理员导航项 -->
    <li class="nav-item">
      <a class="nav-link" href="{{ url_for('admin_dashboard') }}">
        <i class="bi bi-speedometer2"></i> 管理控制台
      </a>
    </li>
    <li class="nav-item">
      <a class="nav-link" href="{{ url_for('admin_users') }}">
        <i class="bi bi-people"></i> 用户管理
      </a>
    </li>
    <li class="nav-item">
      <a class="nav-link" href="{{ url_for('admin_posts') }}">
        <i class="bi bi-file-text"></i> 帖子管理
      </a>
    </li>
    <li class="nav-item">
      <a class="nav-link" href="{{ url_for('admin_knowledge') }}">
        <i class="bi bi-book"></i> 知识管理
      </a>
    </li>
    {% else %}
    <!-- 普通用户导航项 -->
    <li class="nav-item">
      <a class="nav-link" href="{{ url_for('index') }}">
        <i class="bi bi-house"></i> 首页
      </a>
    </li>
    <li class="nav-item">
      <a class="nav-link" href="{{ url_for('health_plan') }}">
        <i class="bi bi-clipboard2-pulse"></i> 健康计划
      </a>
    </li>
    <li class="nav-item">
      <a class="nav-link" href="{{ url_for('health_knowledge') }}">
        <i class="bi bi-egg-fried"></i> 健康知识
      </a>
    </li>
    {% endif %}
  </ul>
  
  <ul class="navbar-nav">
</div>
